﻿<%@ Page Language="C#" MasterPageFile="~/SupplierList/supplierSite.master" AutoEventWireup="true" CodeFile="SupplierListForm.aspx.cs"
    Theme="DXConnect" Inherits="ViewSupplierForm" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v12.1, Version=12.1.4.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx1" %>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    <div class="mainContent registration">
        <div class="contentHeader">
            <div class="content">
                <img id="registrationTitle" src="../Images/title_suppliers.png" 
                    alt="Schedule" />
            </div>
        </div>
        <div class="content">

            <table style="width:100%;">
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
    <asp:Label ID="Label1" runat="server" Text="Search"></asp:Label>
                        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
    <asp:TextBox ID="searchBox" runat="server" MaxLength="30"></asp:TextBox>
    &nbsp;&nbsp;
    <asp:Button ID="searchButt" runat="server" Text="Search by name" 
        onclick="searchButt_Click" />
    &nbsp;
    <asp:Label ID="searchTxt" runat="server"></asp:Label>
&nbsp;&nbsp;
                             </td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        <asp:ListView ID="listSupplier" runat="server" DataKeyNames="SupplierID" 
        DataSourceID="listSupplierData" InsertItemPosition="LastItem" 
        onitemcommand="listSupplier_ItemCommand">
        <AlternatingItemTemplate>
            <tr style="background-color:#FFF8DC;">
                <td>
                    <asp:Label ID="SupplierIDLabel" runat="server" 
                        Text='<%# Eval("SupplierID") %>' />
                </td>
                <td>
                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                </td>
                <td>
                    <asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address") %>' />
                </td>
                <td>
                    <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />
                </td>
                <td>
                    <asp:Label ID="FaxLabel" runat="server" Text='<%# Eval("Fax") %>' />
                </td>
                <td><asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton></td>
            </tr>
        </AlternatingItemTemplate>
        <EditItemTemplate>
            <tr style="background-color:#008A8C;color: #FFFFFF;">
                <td>
                    <asp:Label ID="SupplierIDLabel1" runat="server" 
                        Text='<%# Eval("SupplierID") %>' />
                </td>
                <td>
                    <asp:TextBox ID="NameUp" runat="server" Text='<%# Bind("Name") %>' MaxLength="30"/>
                </td>
                <td>
                    <asp:TextBox ID="AddressUp" runat="server" Text='<%# Bind("Address") %>' MaxLength="60"/>
                </td>
                <td>
                    <asp:TextBox ID="PhoneUp" runat="server" Text='<%# Bind("Phone") %>' MaxLength="15"/>
                </td>
                <td>
                    <asp:TextBox ID="FaxUp" runat="server" Text='<%# Bind("Fax") %>' MaxLength="15"/>
                </td>
                 <td>   
                            <asp:LinkButton ID="lnkUpdate" runat="server" CommandName="Update">Update</asp:LinkButton>
                            <asp:LinkButton ID="lnkDelete" runat="server" CommandName="Delete">Delete</asp:LinkButton>
                            <asp:LinkButton ID="lnkCancel" runat="server" CommandName="Cancel">Cancel</asp:LinkButton>
                 </td>
            </tr>
        </EditItemTemplate>
        <EmptyDataTemplate>
            <table id="Table1" runat="server" 
                style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;">
                <tr>
                    <td>
                        No data was returned.</td>
                </tr>
            </table>
        </EmptyDataTemplate>
        <InsertItemTemplate>
            <tr style="">
            <td>
                    &nbsp;</td>
                <td>
                    <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' MaxLength="30"/>
                </td>
                <td>
                    <asp:TextBox ID="AddressTextBox" runat="server" Text='<%# Bind("Address") %>' MaxLength="60"/>
                </td>
                <td>
                    <asp:TextBox ID="PhoneTextBox" runat="server" Text='<%# Bind("Phone") %>' MaxLength="15"/>
                </td>
                <td>
                    <asp:TextBox ID="FaxTextBox" runat="server" Text='<%# Bind("Fax") %>' MaxLength="15"/>
                </td>
                <td><asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Insert" /></td>
            </tr>
        </InsertItemTemplate>
        <ItemTemplate>
            <tr style="background-color:#DCDCDC;color: #000000;">
                <td>
                    <asp:Label ID="SupplierIDLabel" runat="server" 
                        Text='<%# Eval("SupplierID") %>' />
                </td>
                <td>
                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                </td>
                <td>
                    <asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address") %>' />
                </td>
                <td>
                    <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />
                </td>
                <td>
                    <asp:Label ID="FaxLabel" runat="server" Text='<%# Eval("Fax") %>' />
                </td>
                <td><asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton></td>
            </tr>
        </ItemTemplate>
        <LayoutTemplate>
            <table id="Table2" runat="server">
                <tr id="Tr1" runat="server">
                    <td id="Td1" runat="server">
                        <table ID="itemPlaceholderContainer" runat="server" border="1" 
                            style="background-color: #FFFFFF;border-collapse: collapse;border-color: #999999;border-style:none;border-width:1px;font-family: Verdana, Arial, Helvetica, sans-serif;">
                            <tr id="Tr2" runat="server" style="background-color:#DCDCDC;color: #000000;">
                                <th><asp:LinkButton ID="lnkId" runat="server">
                                    SupplierID</asp:LinkButton></th>
                                <th><asp:LinkButton ID="lnkName" runat="server">
                                    Name</asp:LinkButton></th>
                                <th><asp:LinkButton ID="lnkAddress" runat="server">
                                    Address</asp:LinkButton></th>
                                <th><asp:LinkButton ID="lnkPhone" runat="server">
                                    Phone</asp:LinkButton></th>
                                <th><asp:LinkButton ID="lnkFax" runat="server">
                                    Fax</asp:LinkButton></th>
                            </tr>
                            <tr ID="itemPlaceholder" runat="server">
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr id="Tr3" runat="server">
                    <td id="Td2" runat="server" 
                        style="text-align: center;background-color: #CCCCCC;font-family: Verdana, Arial, Helvetica, sans-serif;color: #000000;">
                    </td>
                </tr>
            </table>
        </LayoutTemplate>
        <SelectedItemTemplate>
            <tr style="background-color:#008A8C;font-weight: bold;color: #FFFFFF;">
                <td>
                    <asp:Label ID="SupplierIDLabel" runat="server" 
                        Text='<%# Eval("SupplierID") %>' />
                </td>
                <td>
                    <asp:Label ID="NameLabel" runat="server" Text='<%# Eval("Name") %>' />
                </td>
                <td>
                    <asp:Label ID="AddressLabel" runat="server" Text='<%# Eval("Address") %>' />
                </td>
                <td>
                    <asp:Label ID="PhoneLabel" runat="server" Text='<%# Eval("Phone") %>' />
                </td>
                <td>
                    <asp:Label ID="FaxLabel" runat="server" Text='<%# Eval("Fax") %>' />
                </td>
                <td><asp:LinkButton ID="lnkEdit" runat="server" CommandName="Edit">Edit</asp:LinkButton></td>
            </tr>
        </SelectedItemTemplate>
    </asp:ListView>&nbsp;
            <asp:SqlDataSource ID="listSupplierData" runat="server" 
        ConnectionString="<%$ ConnectionStrings:CocShopDatabaseConnectionString %>" 
        SelectCommand="SELECT * FROM [Supplier]"></asp:SqlDataSource>
    </td>

                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                    <td>
                        &nbsp;</td>
                </tr>
                <tr>
                    <td>
                        &nbsp;</td>
                    <td>
                    </td>
                    <td>
                        &nbsp;</td>
                </tr>
            </table>

        </div>
    </div>
</asp:Content>
